package com.kingint.web.portal.base.controller;


import com.kingint.common.unitedresult.K;
import com.kingint.mbg.bas.entity.BasDepartment;
import com.kingint.mbg.dto.BackQueryParam;
import com.kingint.mbg.dto.MemberReturn;
import com.kingint.web.portal.base.service.DepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "department")
@Api(value = "DepartmentController", description = "前端部门表")
public class DepartmentController {
    @Resource
    private DepartmentService departmentService;


    @ApiOperation(value = "获取登录用户对应部门列表信息")
    @GetMapping("/gethoteldepartmentList")
    public Object getHotelDepartmentList(){
        List<BasDepartment> departmentList = departmentService.getAllDepartmentList();
        return K.ok().data(departmentList);
    }

    @ApiOperation(value = "获取某一部门下的人员信息")
    @GetMapping("/getdepartmentoneperson")
    public Object getDepartmentOnePerson(Integer departmentId){
        List<MemberReturn> onePerson = departmentService.getDepartmentOnePerson(departmentId, 1);
        return K.ok().data(onePerson);
    }

    //获取部门下的通讯录
    @ApiOperation(value = "获取部门下的人员联系信息")
    @GetMapping("/getPhoneList")
    public Object getPhoneList(BackQueryParam queryParam){
        List<BasDepartment> list= departmentService.getPhoneList(queryParam);
        return K.ok().data(list);
    }
}
